-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce MASKING
operator in triggerExpression::Parser
#39196
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39196/31807
|
A new Pull Request was created by @missirol (Marino Missiroli) for master. It involves the following packages:
@cmsbuild, @missirol, @Martin-Grunewald can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
Can multiple For example, what happens with |
void maskTriggers(L1uGTReader const&); | ||
|
||
bool useTriggersAfterMasking() const { return m_useTriggersAfterMasking; } | ||
void useTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the general recommendation is to use
bool useTriggersAfterMasking() const { return m_useTriggersAfterMasking; }
void setUseTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; }
bool operator()(const Data& data) const override { | ||
// force the execution of both arguments, otherwise prescalers won't work properly | ||
bool r1 = (*m_arg1)(data); | ||
(*m_arg2)(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed, if MASKING
does not support prescaled right-hand arguments ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say no, indeed, but I wasn't 100% sure about it because of the comment on the prescalers. Since a prescale operator cannot be on the right side of MASKING
in any case, I think it's safe to remove this.
Yes, this is equivalent to I think the sequence of calls is the following:
|
I tried this, and it works as expected (no changes). I plan to apply the following changes in the next push, based on the comments by Andrea. diff --git a/HLTrigger/HLTcore/interface/TriggerExpressionL1uGTReader.h b/HLTrigger/HLTcore/interface/TriggerExpressionL1uGTReader.h
index 038c30fe4a9..1306de60952 100644
--- a/HLTrigger/HLTcore/interface/TriggerExpressionL1uGTReader.h
+++ b/HLTrigger/HLTcore/interface/TriggerExpressionL1uGTReader.h
@@ -32,7 +32,7 @@ namespace triggerExpression {
void maskTriggers(L1uGTReader const&);
bool useTriggersAfterMasking() const { return m_useTriggersAfterMasking; }
- void useTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; }
+ void setUseTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; }
private:
std::string m_pattern;
diff --git a/HLTrigger/HLTcore/interface/TriggerExpressionOperators.h b/HLTrigger/HLTcore/interface/TriggerExpressionOperators.h
index 1a0c73bf362..2bdeb15a828 100644
--- a/HLTrigger/HLTcore/interface/TriggerExpressionOperators.h
+++ b/HLTrigger/HLTcore/interface/TriggerExpressionOperators.h
@@ -136,12 +136,7 @@ namespace triggerExpression {
public:
OperatorMasking(Evaluator* arg1, Evaluator* arg2) : BinaryOperator(arg1, arg2) {}
- bool operator()(const Data& data) const override {
- // force the execution of both arguments, otherwise prescalers won't work properly
- bool r1 = (*m_arg1)(data);
- (*m_arg2)(data);
- return r1;
- }
+ bool operator()(const Data& data) const override { return (*m_arg1)(data); }
void init(const Data& data) override {
m_arg1->init(data);
@@ -149,6 +144,10 @@ namespace triggerExpression {
m_arg1->mask(m_arg2.get());
}
+ // apply mask(s) to the first Evaluator
+ // (the 2nd Evaluator is not used anyway in the decision of OperatorMasking)
+ void mask(Evaluator* arg) override { m_arg1->mask(arg); }
+
void dump(std::ostream& out) const override {
out << '(';
m_arg1->dump(out);
diff --git a/HLTrigger/HLTcore/interface/TriggerExpressionPathReader.h b/HLTrigger/HLTcore/interface/TriggerExpressionPathReader.h
index 6c3e24039c7..51ec0a3aea9 100644
--- a/HLTrigger/HLTcore/interface/TriggerExpressionPathReader.h
+++ b/HLTrigger/HLTcore/interface/TriggerExpressionPathReader.h
@@ -34,7 +34,7 @@ namespace triggerExpression {
void maskTriggers(PathReader const&);
bool useTriggersAfterMasking() const { return m_useTriggersAfterMasking; }
- void useTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; }
+ void setUseTriggersAfterMasking(bool const foo) { m_useTriggersAfterMasking = foo; }
private:
std::string m_pattern; |
e8988d9
to
0bd9d8e
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39196/31893
|
Pull request #39196 was updated. @cmsbuild, @missirol, @Martin-Grunewald can you please check and sign again. |
0bd9d8e
to
ba2e4b3
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39196/31894
|
626c61c
to
5cd0ad7
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39196/32029
|
5cd0ad7
to
aa32f59
Compare
Pull request #39196 was updated. @cmsbuild, @missirol, @Martin-Grunewald can you please check and sign again. |
The last push simply rebases the PR on a recent IB. Unless there are comments, I plan to move forward with its integration in |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-afde59/27395/summary.html Comparison SummarySummary:
|
+hlt
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
This PR aims to add a new operator to the syntax supported by the
triggerExpression::Parser
class.The new operator is binary, and tentatively [0] named
MASKING
.Given a generic expression
ExprFoo
(e.g.L1_A* OR L1_B*
) and a generic patternPattBar
(e.g.L1*copy*
),ExprFoo MASKING PattBar
corresponds to evaluatingExprFoo
disabling in it ("masking") all the triggers matchingPattBar
.More details on the syntax are given in [1].
A use case for this comes from HLT online operations [2], see for example CMSHLT-2403.
The idea to introduce a new logical operator to solve this issue comes from @fwyzard.
Unit tests in HLT packages are updated accordingly.
Merely technical. No changes expected.
[0] Feel free to suggest a better name (it can be changed, of course); I just found
MASKING
slightly clearer thanEXCEPT
orBUT
.[1] Esp. during commissioning, "copies" of some L1T seeds are used online for tests (e.g. having
L1_ZeroBias_copy
with loose PSs for high-rate tests, leavingL1_ZeroBias
and the HLTs seeded by it unaffected), while HLT tipically wants to ignore such "copy" seeds in the collection of "HLTPhysics" data (L1A Physics triggers). For this reason, right now in the online menu the (Ephemeral)HLTPhysics triggers are seeded by a EDFilter containing (for lack of a better syntax) the explicit list of all L1T seeds which are not "copy" seeds (over 300 strings), which is clearly difficult to maintain. Using the equivalentL1_* MASKING L1_ZeroBias_copy
would be the better approach.[2] Behaviour of
MASKING
operator:In
(PATTERN_A OR/AND PATTERN_B) MASKING PATTERN_C
, all matches ofPATTERN_C
are masked in bothPATTERN_A
andPATTERN_B
.The argument of the
MASKING
operation (i.e.B
inA MASKING B
) can be only a single pattern corresponding to L1T seeds (class:TriggerExpressionL1uGTReader
) or HLT paths (class:TriggerExpressionPathReader
); the argument cannot be a constant (TRUE
orFALSE
), a prescale expression (e.g.X / N
), nor a unary or a binary operator; if unsupported arguments are used, e.g. ([..] MASKING (THIS AND THAT)
), the parsing will fail. Examples of unsupported expressions:EXPR_A MASKING (PATTERN_B AND/OR PATTERN_C)
,EXPR_A MASKING (NOT PATTERN_B)
,EXPR_A MASKING TRUE
,EXPR_A MASKING (PATH / N)
.PR validation:
Improved unit tests pass.
If this PR is a backport, please specify the original PR and why you need to backport that PR. If this PR will be backported, please specify to which release cycle the backport is meant for:
TSG might want to backport this new feature down to
CMSSW_12_4_X
for online operations.